package service

import (
	"context"
	"devops-super/api"
	v1 "devops-super/api/product/v1"
	"devops-super/internal/model/entity"
	"devops-super/internal/model/mymodel"
)

type IFirmware interface {
	// Add 添加固件
	Add(ctx context.Context, in *entity.AppFirmware) (err error)

	// Upt 更新固件
	Upt(ctx context.Context, in *entity.AppFirmware) (err error)

	// GetPageLst 分页获取固件列表
	GetPageLst(ctx context.Context, in *v1.GetFirmwarePageLstReq) (out *api.PageLstRes[*mymodel.AppFirmwareResponse], err error)

	// Del 删除固件
	Del(ctx context.Context, id int) (err error)

	// GetOne 获取一条
	GetOne(ctx context.Context, id int) (out *entity.AppFirmware, err error)

	// GetOptions 获取表单固件选项
	GetOptions(ctx context.Context, in *v1.GetFirmwareOptionsReq) (out *v1.GetFirmwareOptionsRes, err error)
}

var (
	localFirmware IFirmware
)

func Firmware() IFirmware {
	if localFirmware == nil {
		panic("implement not found for interface IFirmware, forgot register?")
	}
	return localFirmware
}

func RegisterFirmware(i IFirmware) {
	localFirmware = i
}
